﻿using System.Data.Objects.DataClasses;

namespace CivilRegistry.ControlledModel.Repository
{
    /// <summary>
    /// Abstract repository interface.
    /// </summary>
    /// <typeparam name="TEntity">The entity.</typeparam>
    public interface IabstractRepository<TEntity> : IFinder<TEntity>
        where TEntity : EntityObject
    {
        /// <summary>
        /// To update the entity on database.
        /// </summary>
        /// <param name="entity">The entity to update.</param>
        /// <returns>The updated entity object.</returns>
        TEntity Update(TEntity entity);

        /// <summary>
        /// To insert the entity object to databse.
        /// </summary>
        /// <param name="entity">The entity object to insert.</param>
        /// <returns>The inserted entity object.</returns>
        TEntity Insert(TEntity entity);

        /// <summary>
        /// To delete the entity object from database.
        /// </summary>
        /// <param name="entity">The entity object to delete.</param>
        void Delete(TEntity entity);
    }
}